<template>
		<div class="tabbar-item" @click="itemclick()">
				<div v-if="!Isactive"><slot name="item-icon"></slot></div>
				<div v-else><slot name="item-activeicon"></slot></div>
				<div :style="activestyle"><slot name="item-text"></slot></div>
		</div>
</template>

<script>
	export default{
		name:"TabbarItem",
		props:{
			path:String,
			activecolor:{
				type:String,
				default:"#1296db"
			}
		},
		computed:{
			Isactive(){
				return this.$route.path.indexOf(this.path)!==-1
			},
			activestyle(){
				return this.Isactive ? {color:this.activecolor} : {}
			}
		},
		methods:{
			itemclick(){
				this.$router.replace(this.path)		
			}	
		}
		
	}
</script>

<style>
	.tabbar-item{
		flex:1;
		text-align: center;
		height:49px;
		font-size: 12px;
	}
	.tabbar-item img{
		width:24px;
		margin-top: 3px;
		margin-bottom: 2px;

	}
	.active{
		color:#1296db;
		}
</style>
